package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

func VideoReview(title string) (bool, error) {
	client := censor.NewClient("ak", "sk")
	//如果是百度云ak sk,使用下面的客户端

	res := client.TextCensor(title)

	var data map[string]interface{}

	json.Unmarshal([]byte(res), &data)

	if conclusion, ok := data["conclusion"].(string); ok && conclusion != "合规" {
		return false, fmt.Errorf("审核失败")
	}

	return true, nil

}
